﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Diagnostics;

namespace SimpleIR
{
	/// <summary>
	/// Represents a single member field object.
	/// </summary>
	public sealed class IRMemberField : IRCompareableName
	{
		/// <summary>
		/// The field qualifier tag for this field.
		/// </summary>
		public readonly FieldQualifiers FieldQualifier;

		/// <summary>
		/// The class type where this field is defined.
		/// </summary>
		public readonly IRType DefinedInClass;

		/// <summary>
		/// The name of this field.
		/// </summary>
		public readonly String FieldName;

		/// <summary>
		/// Return the type that is stored in this field.
		/// </summary>
		public readonly IRType FieldType;

		internal IRMemberField(IRType defClass, string name, IRType fieldType, FieldQualifiers qual)
			: base()
		{
			this.FieldQualifier = qual;

			this.DefinedInClass = defClass;
			this.FieldName = name;
			this.FieldType = fieldType;
		}

		public override string ToString()
		{ return this.DefinedInClass.ToString() + "." + this.FieldName; }
	}
}
